package com.itheima.es_goods_demo.web;

import com.itheima.es_goods_demo.pojo.Goods;
import com.itheima.es_goods_demo.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/findAll")
    public void findAll(){
        System.out.println(goodsService.findAll());
    }

    @GetMapping("/findGoodsById/{id}")
    public Goods findGoodsById(@PathVariable("id") Long id){
      return goodsService.findGoodsById(id);
    }

    @GetMapping("/export")
    public void export(){
        goodsService.export();
    }

}
